﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace PDDP
{
    public partial class frmPesquisa : Form
    {
        public frmPesquisa()
        {
            InitializeComponent();
        }

        private void btoPesquisa_Click(object sender, EventArgs e)
        {
            this.Tag = txtPesquisa.Text;
            this.Close();
        }

        private void frmPesquisa_KeyUp(object sender, KeyEventArgs e)
        {

            if (e.KeyValue == 27 && !e.Control && !e.Shift)
            {
                this.Close();
            }

            if (e.KeyValue == 13 && !e.Control && !e.Shift)
            {
                this.Tag = txtPesquisa.Text;
                this.DialogResult = DialogResult.OK;
                this.Close();
            }

        }

        private void frmPesquisa_Shown(object sender, EventArgs e)
        {
            if (this.Tag != null)
                txtPesquisa.Text = this.Tag.ToString();
            txtPesquisa.SelectAll();
            txtPesquisa.Focus();
            this.Tag = "";
        }

    }

}
